$(document).ready(function() {
	
	
	$("input[type='submit'][value='agregar']").attr("disabled", true);
	$("input[type='submit'][value='eliminar']").attr("disabled", true);
	$("input[type='radio']").prop('checked',false);

	
	
	$("input[type='radio']").change(function() {
		//alert("cambioRadio: " + $(this).attr("id"));
		//alert("cambioRadio: " + $(this).prop('checked'));
		//alert("valueRadio: " + $(this).val());
		if($(this).prop('checked')){
			$("input[type='submit'][value='agregar']").attr("disabled", true);
			$("input[type='submit'][value='eliminar']").attr("disabled", true);

			$("input[type='radio']").prop('checked',false);
			$("input[type='radio'][id='"+ $(this).attr("id")+"'][value='"+$(this).attr("id")+"'][marca='"+$(this).attr("marca")+"']").prop('checked',true);
			$("input[type='submit'][id='"+ $(this).attr("id")+"'][value='"+$(this).attr("marca")+"']").attr("disabled", false)
			
		}
	});
	
	
	var sinStockId = $("#sinStock").attr("value");
	var noAgregadoId = $("#noAgregado").attr("value");
	
	$("input[type='submit'][value='agregar'][id='"+sinStockId+"']").attr("disabled", true);
	$("input[type='submit'][value='eliminar'][id='"+noAgregadoId+"']").attr("disabled", true);
});
